import java.util.Arrays;
import java.util.Scanner;

public class Demo8 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int n = scan.nextInt();
        int[][] arr = new int[n][n];

        for (int i = 0; i < n; i++) {
            arr[i][0] = 1;
            arr[i][i] = 1;
        }

        for (int i = 2; i < n; i++) {
            for (int j = 1; j < i; j++) {
                arr[i][j] = arr[i - 1][j - 1] + arr[i - 1][j];
            }
        }

        for (int i = 0; i < n; i++) {
            System.out.println(Arrays.toString(arr[i]));
        }

        int ret = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j <= i; j++) {
                ret++;
                if (arr[i][j] == n) {
                    System.out.println(ret);
                    break;
                }
            }
        }

        scan.close();
    }
}
